#ifndef __RETINANET_H__
#define __RETINANET_H__

#include <string>
#include <vector>

#define RETINA_INPUT_SIZE (608)
#define RETINA_FPN_LAYER_NUM (5) // retinanet detect on 5 features, == pstDetParam->stModel.astSeg->u16DstNum
#define RETINA_LABEL_NUM (20) // retinanet label num
#define RETINA_PER_ANCHOR_NUM (9) // per anchor num
#define RETINA_LOC_NUM (4) // xyxy
#define RETINA_CLASS_THRESHOLD (0.00f) // conf threshold to detect
#define SHOW_CLASS_THRESHOLD (0.0f) // conf threshold to show
#define NMS_IOU_THRESHOLD (0.5f) // nms IoU threshold

#define SAVE_RESULT_NUM_MAX (76*76) // all class
#define DETECTION_RESULT_NUM_MAX (100) // per class

typedef struct mySVP_SOFT_RETINA_S
{
	HI_S32* detection_input_data[RETINA_FPN_LAYER_NUM]; // NNIE loc result
	HI_S32* softmax_input_data[RETINA_FPN_LAYER_NUM]; // NNIE conf result

	HI_U32 feature_width[RETINA_FPN_LAYER_NUM];
	HI_U32 feature_height[RETINA_FPN_LAYER_NUM];
	HI_U32 feature_stride[RETINA_FPN_LAYER_NUM];
	HI_U32 feature_channel_loc[RETINA_FPN_LAYER_NUM];
	HI_U32 feature_channel_conf[RETINA_FPN_LAYER_NUM];

	HI_S32 anchor_size[RETINA_FPN_LAYER_NUM]; // 32 64 128 256 512
	HI_S32 image_stride[RETINA_FPN_LAYER_NUM]; // 8 16 32 64 128
	HI_FLOAT anchor_rate[3]; // 0.5 1 2
	HI_FLOAT anchor_scale[3]; // 1 1.26 1.587

	HI_U32 u32ResultMemSize; // size of memory to save [sroce class x y x y]
	HI_FLOAT *ps32ResultMem; // to save [sroce class x y x y]
	HI_U32 total_detection_num; // how many bbox detected

	HI_U32 u32SuppressionSize; // size of record nms
	bool *is_suppression; // to save suppression result

	HI_U32 u32FinalBboxSize; // size of memory to save [sroce class x y x y]
	HI_FLOAT *ps32FinalBbox; // to save [sroce class x y x y]
	HI_U32 final_detection_num; // how many bbox detected
} SVP_SOFT_RETINA_S;

HI_S32 Retinanet();


#endif //__SVP_SAMPLE_WK_H__
